//--------------------------------------------------------------------------- 
#ifndef Parser_cplexH 
#define Parser_cplexH

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <iostream>

#include <ilcplex/cplex.h>
#include <assert.h>

#include "CGR.h"

using namespace std;

//---------------------------------------------------------------------------
class Parser_cplex
{
public:
    CPXENVptr 	lpEnv;
    CPXLPptr 		lp;

    int 			solStat;
    double 			objValue;
    double 			* primalSol;
    double 			* dualSol; 
    double			* reducedCost;
    double			* ilpSol;

    int   numcols;
    int   numrows;

    int * cmatbeg;
    int * cmatind;
    double * cmatval;
    double * lb;
    double * ub;
    double * obj;
    int   routeNum;
    int   kParam;

    int getCplex ();

    int DeleteProblemLP (); 

    int CGR_CreateProblemLP ();

    int CGR_SolveLP (CPXENVptr env, CPXLPptr lp);

    int CGR_AddNewRows (CPXENVptr env, CPXLPptr lp);

    int CGR_AddGridEdgeColumns (CPXENVptr env, CPXLPptr lp);

    int CGR_AddCoarseNetColumns (CPXENVptr env, CPXLPptr lp);

    int  CGR_AddSingleEdge ( CPXENVptr env, CPXLPptr lp, int index_in_E_id ); 

    int  CGR_AddSingleRoute ( CPXENVptr env, CPXLPptr lp, subnetIdType subnet_full_id ); 
    void Free_and_Null (char **ptr);
    void Sleep (int sleeptime);
    bool GetSelfLicense ();
    void ReleaseSelfLicense ();
};
//---------------------------------------------------------------------------
extern Parser_cplex pcplex;
//---------------------------------------------------------------------------
#endif

